package systemInformation;

import org.snmp4j.smi.Integer32;

public enum ProcessStatus {
	running("In esecuzione"),
	runnable("Eseguibile"),
	notRunnable("Non eseguibile"),
	invalid("Non valido");
	
	private String description = null;
	
	private ProcessStatus(String description) {
		this.description = description;
	}

	public int getValue() {
		switch (this) {
		case running: default: return 1;
		case runnable: return 2;
		case notRunnable: return 3;
		case invalid: return 4;
		}
	}
	
	@Override
	public String toString() {
		return description;
	}
	
	public Integer32 toVariable() {
		return new Integer32(getValue());
	}
	
	public static ProcessStatus fromVariable(Integer32 variable) {
		return fromInt(variable.getValue());
	}
	
	public static ProcessStatus fromInt(int value) {
		switch (value) {
		case 1: default: return running;
		case 2: return runnable;
		case 3: return notRunnable;
		case 4: return invalid;
		}
	}
}
